package com.woniuxy.ams.service.impl;

import com.woniuxy.ams.dao.CompanyScoringDao;
import com.woniuxy.ams.entity.AssessItem;
import com.woniuxy.ams.entity.CompanyInspectList;
import com.woniuxy.ams.entity.Dept;
import com.woniuxy.ams.service.ICompanyScoringService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公司考核列表评分service
 */
@Service
public class CompanyScoringServiceImpl implements ICompanyScoringService {


    /**
     * 注入dao
     */
    @Resource
    CompanyScoringDao companyScoringDao;

    /**
     * 新增考核列表与被考核部门与考核项
     * @param companyInspectList
     * @param assessItems
     * @param depts
     * @return int
     */
    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
    public int addScoringData(CompanyInspectList companyInspectList, List<AssessItem> assessItems, List<Dept> depts) {
        return companyScoringDao.addScoringData(companyInspectList, assessItems, depts);
    }
}
